home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / usr / sybase / doc / dbcmd.man < prev    next >
Text File  |  1993-04-22  |  3KB  |  111 lines

  1.  
  2.   1                       Version 4.0 -- 5/1/89                    dbcmd
  3.   ______________________________________________________________________
  4.  
  5.   NAME:  dbcmd
  6.  
  7.   FUNCTION:
  8.        Add text to the DBPROCESS command buffer.
  9.  
  10.   SYNTAX:
  11.        RETCODE dbcmd(dbproc, cmdstring)
  12.  
  13.        DBPROCESS *dbproc;
  14.        char      *cmdstring;
  15.  
  16.   COMMENTS:
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.   dbcmd                   Version 4.0 -- 5/1/89                        2
  25.   ______________________________________________________________________
  26.  
  27.        o This routine adds text to the Transact-SQL  command  buffer  in
  28.          the  DBPROCESS  structure.   It  adds  to  the existing command
  29.          buffer-it doesn't delete  or  overwrite  the  current  contents
  30.          except  after  the  buffer  has  been  sent  to SQL Server (see
  31.          below).  A single command buffer may contain multiple commands;
  32.          in  fact,  this  represents  an  efficient  use  of the command
  33.          buffer.
  34.        o The application  may  call  dbcmd()  repeatedly.   The  command
  35.          strings  in sequential calls are just concatenated together. It
  36.          is the application's responsibility to ensure that  any  neces-
  37.          sary blanks appear between the end of one string and the begin-
  38.          ning of the next.
  39.  
  40.        o After a call to dbsqlexec() or dbsqlsend(), the first  call  to
  41.          either  dbcmd()  or  dbfcmd()  automatically clears the command
  42.          buffer before the new text is entered.  If  this  situation  is
  43.          undesirable, set the DBNOAUTOFREE option.  When DBNOAUTOFREE is
  44.  
  45.  
  46.   3                       Version 4.0 -- 5/1/89                    dbcmd
  47.   ______________________________________________________________________
  48.          set, the command buffer is cleared only by an explicit call  to
  49.          dbfreebuf().
  50.  
  51.        o Here's a small example of using dbcmd() to build  up  a  multi-
  52.          line SQL command:
  53.  
  54.              DBPROCESS       *dbproc;
  55.  
  56.              dbcmd(dbproc, "select name from sysobjects");
  57.              dbcmd(dbproc, " where id < 5");
  58.              dbcmd(dbproc, " and type='S'");
  59.  
  60.          Note the required spaces at the start of the second  and  third
  61.          command strings.
  62.        o dbfcmd()  is  a  related  function.   dbfcmd()  interprets  the
  63.          cmdstring  as a format string that is passed to sprintf() along
  64.          with any additional arguments.  The application can intermingle
  65.  
  66.  
  67.  
  68.   dbcmd                   Version 4.0 -- 5/1/89                        4
  69.   ______________________________________________________________________
  70.          calls to dbcmd() and dbfcmd().
  71.  
  72.        o At any time, the application can access  the  contents  of  the
  73.          command  buffer  through  calls to dbgetchar(), dbstrlen(), and
  74.          dbstrcpy().
  75.  
  76.   PARAMETERS:
  77.        dbproc -  A pointer to the DBPROCESS structure that provides  the
  78.            connection for a particular front-end/SQL Server process.  It
  79.            contains all the information that DB-Library uses  to  manage
  80.            communications and data between the front end and SQL Server.
  81.        cmdstring -  A  null-terminated  character  string  that  dbcmd()
  82.            copies into the command buffer.
  83.  
  84.   RETURNS:
  85.        SUCCEED or FAIL.
  86.  
  87.  
  88.  
  89.  
  90.   5                       Version 4.0 -- 5/1/89                    dbcmd
  91.   ______________________________________________________________________
  92.  
  93.   SEE ALSO:
  94.        dbfcmd, dbfreebuf, dbgetchar, dbstrcpy, dbstrlen, options
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.